﻿#region Copyright

// Majesty of Omega - The next evolution of macro management space strategy
// 
// Copyright 2007-2009 André Claaßen
// 
// This file is protected by the terms and conditions of the
// Microsoft Community License (Ms-CL 1.1), a copy of which should
// have been distributed along with this software. If not,
// you may find the license information at the following URL:
// 
// http://www.microsoft.com/resources/sharedsource/licensingbasics/communitylicense.mspx

#endregion

using Majesty_of_Omega.Config;
using System.Text;

namespace Majesty_of_Omega.GUI.Controller
{
    ///<summary>
    /// Controller for the Main Page
    ///</summary>
    public class MainPageController : Controller
    {
        ///<summary>
        /// Property returns the credits text for data binding
        ///</summary>
        public string CreditsText
        {
            get
            {
                StringBuilder builder = new StringBuilder();
                Credits credits = SpreadSheetManager.Credits;

                foreach (var creditsGroup in credits.Group)
                {
                    builder.Append(creditsGroup.name);
                    builder.Append(": ");
                    foreach (var creditsGroupPerson in creditsGroup.Person)
                    {
                        builder.Append(creditsGroupPerson.name);
                        if (!string.IsNullOrEmpty(creditsGroupPerson.nick))
                            builder.Append("  (" + creditsGroupPerson.nick+")  ");
                        builder.Append(" - ");
                        builder.Append(creditsGroupPerson.text);
                        builder.Append("                            ");
                    }
                    builder.Append("                                                           ");
                }
                return builder.ToString();
            }
        }
    }
}